/**
 *
 * Licensed Materials - Property of IBM 
 * 
 * OCO Source Materials 
 * 
 * (C) Copyright IBM Corp. 2011, 2012 All Rights Reserved 
 * 
 * The source code for this program is not published or other- 
 * wise divested of its trade secrets, irrespective of what has 
 * been deposited with the U.S. Copyright Office. 
 *
 */

/**
 * CHANGE HiSTORY:
 * Author             Time                 Description
 *
 */
package com.ibm.ba.demo.entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Customers {
	
	@Value("${demo.customerIds}")
	private String allCustomerIdsString;


	public String getAllCustomerIdsString() {
		return allCustomerIdsString;
	}

	public void setAllCustomerIdsString(String allCustomerIdsString) {
		this.allCustomerIdsString = allCustomerIdsString;
	}

	public List<String> getAllCustomerIdsStringList() {
		if (allCustomerIdsString != null) {
			return Arrays.asList(allCustomerIdsString.split(","));
		} else {
			return null;
		}
	}

	public List<Integer> getAllCustomerIdsIntegerList() {
		List<String> tempList = getAllCustomerIdsStringList();
		List<Integer> resultList = new ArrayList<Integer>();
		if (tempList != null) {
			for (int i = 0; i < tempList.size(); i++) {
				resultList.add(Integer.parseInt(tempList.get(i)));
			}
			return resultList;
		} else {
			return null;
		}
	}

}
